import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
// git のイメージ(一部だけ)
static class Blob { // (リポジトリ内にコピー保存された)ファイル int fileSize;
long lastUpdate;
}
static class Commit {
HashMap
<String, Blob
> blobs
; // このコミットが持つ全てのファイル(Blob) ArrayList<Commit> parents; // このコミットの親
ArrayList<Commit> children; // このコミットの子
public Commit() {}
public boolean include(Commit commit) {
if (this == commit) return true;
for (Commit parent : parents) {
if (parent.include(commit)) return true;
}
return false;
}
}
static class Branch {
Commit HEAD;
public Branch
(String name, Commit head
) { this.name = name;
HEAD = head;
}
public void merge(Branch b) {
if (b.HEAD.include(this.HEAD)) {
fastForward(b.HEAD);
} else {
// 2つのHEAD(Commit)が持つファイルを比較して
// 必要なら各ファイルごとにマージして
// その結果を新しいコミットに記録して
// その新しいコミットをこのBranchのHEADとする
}
}
private void fastForward(Commit head) {
HEAD = head;
}
}
static class Tag {
final Commit commit;
public Tag
(String name, Commit commit
) { this.name = name;
this.commit = commit;
}
}
{
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJLy8gZ2l0IOOBruOCpOODoeODvOOCuCjkuIDpg6jjgaDjgZEpCgkKCQoJc3RhdGljIGNsYXNzIEJsb2IgeyAvLyAo44Oq44Od44K444OI44Oq5YaF44Gr44Kz44OU44O85L+d5a2Y44GV44KM44GfKeODleOCoeOCpOODqyAKCQlTdHJpbmcgaGFzaDsKCQlTdHJpbmcgZmlsZVBhdGg7CgkJaW50ICAgIGZpbGVTaXplOwoJCWxvbmcgICBsYXN0VXBkYXRlOwoJCXB1YmxpYyBCbG9iKCkge30KCX0KCQoJc3RhdGljIGNsYXNzIENvbW1pdCB7CgkJU3RyaW5nIGhhc2g7CgkJSGFzaE1hcDxTdHJpbmcsIEJsb2I+IGJsb2JzOyAvLyDjgZPjga7jgrPjg5/jg4Pjg4jjgYzmjIHjgaTlhajjgab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