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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: E = None
        self.w: B = None
        self.y: F = None
        self.s: D = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.q: E = None
        self.y: E = None
        self.v: E = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
i = D("i")
d = E("d")
n = F("n")
e = B("e")
f = A("f")
a = E("a")

g.t = k
c.p = f
c.z = k
c.u = k
k.t = a
k.q = d
k.w = e
k.y = n
k.u = n
k.s = i
i.x = f
d.p = k
d.o = a
d.q = a
d.y = a
d.v = a
d.r = c
n.q = f
e.p = g
e.z = k
e.u = k
f.t = k
a.p = k
a.o = d
a.q = d
a.y = d
a.v = d
a.r = e
assert k.q.r.p.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.z: C = None
        self.u: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: E = None
        self.w: B = None
        self.y: F = None
        self.s: D = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: E = None
        self.q: E = None
        self.y: E = None
        self.v: E = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
i = D("i")
d = E("d")
n = F("n")
e = B("e")
f = A("f")
a = E("a")

g.t = k
c.p = f
c.z = k
c.u = k
k.t = a
k.q = d
k.w = e
k.y = n
k.u = n
k.s = i
i.x = f
d.p = k
d.o = a
d.q = a
d.y = a
d.v = a
d.r = c
n.q = f
e.p = g
e.z = k
e.u = k
f.t = k
a.p = k
a.o = d
a.q = d
a.y = d
a.v = d
a.r = e
assert k.q.r.p.t.w.txt == "e"