class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.v: F = None
        self.w: F = None
        self.y: E = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: D = None
        self.x: F = None
        self.s: E = None
        self.txt = txt

m = A("m")
h = B("h")
n = C("n")
i = D("i")
d = E("d")
j = F("j")
g = G("g")
e = B("e")
b = G("b")
f = E("f")

m.x = n
m.z = n
m.v = j
m.w = j
m.y = f
m.u = d
h.t = n
n.o = d
n.p = b
i.x = n
i.w = n
i.s = h
d.o = f
j.o = h
g.p = m
g.t = i
g.x = j
g.s = f
e.t = n
b.p = m
b.t = i
b.x = j
b.s = d
f.o = d
assert b.p.y.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: C = None
        self.v: F = None
        self.w: F = None
        self.y: E = None
        self.u: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: D = None
        self.x: F = None
        self.s: E = None
        self.txt = txt

m = A("m")
h = B("h")
n = C("n")
i = D("i")
d = E("d")
j = F("j")
g = G("g")
e = B("e")
b = G("b")
f = E("f")

m.x = n
m.z = n
m.v = j
m.w = j
m.y = f
m.u = d
h.t = n
n.o = d
n.p = b
i.x = n
i.w = n
i.s = h
d.o = f
j.o = h
g.p = m
g.t = i
g.x = j
g.s = f
e.t = n
b.p = m
b.t = i
b.x = j
b.s = d
f.o = d
assert b.p.y.o.o.o.o.o.o.o.o.txt == "f"