class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.t: F = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.y: B = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

g = A("g")
c = B("c")
d = C("d")
h = D("h")
n = E("n")
j = F("j")
l = C("l")
b = C("b")
i = F("i")

g.q = h
g.y = c
g.z = n
c.t = i
d.r = c
d.x = b
d.t = j
d.p = n
h.o = c
h.v = c
h.y = c
h.z = n
n.r = h
n.u = h
n.z = d
j.w = c
j.x = i
l.r = c
l.x = b
l.t = i
l.p = n
b.r = c
b.x = d
b.t = i
b.p = n
i.w = c
i.x = j
assert b.t.w.t.x.w.t.x.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.y: B = None
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: C = None
        self.t: F = None
        self.p: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.y: B = None
        self.z: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

g = A("g")
c = B("c")
d = C("d")
h = D("h")
n = E("n")
j = F("j")
l = C("l")
b = C("b")
i = F("i")

g.q = h
g.y = c
g.z = n
c.t = i
d.r = c
d.x = b
d.t = j
d.p = n
h.o = c
h.v = c
h.y = c
h.z = n
n.r = h
n.u = h
n.z = d
j.w = c
j.x = i
l.r = c
l.x = b
l.t = i
l.p = n
b.r = c
b.x = d
b.t = i
b.p = n
i.w = c
i.x = j
assert b.t.w.t.x.w.t.x.w.t.txt == "i"