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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

m = A("m")
e = B("e")
g = C("g")
c = A("c")
d = C("d")
k = C("k")
j = B("j")
f = B("f")

m.x = k
m.t = d
m.u = g
e.v = j
e.p = j
g.p = j
g.q = e
g.z = d
c.x = d
c.t = g
c.u = g
d.p = f
d.q = e
d.z = g
k.p = j
k.q = e
k.z = d
j.v = f
j.p = e
f.v = j
f.p = j
assert m.u.z.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.t: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: B = None
        self.txt = txt

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

m = A("m")
e = B("e")
g = C("g")
c = A("c")
d = C("d")
k = C("k")
j = B("j")
f = B("f")

m.x = k
m.t = d
m.u = g
e.v = j
e.p = j
g.p = j
g.q = e
g.z = d
c.x = d
c.t = g
c.u = g
d.p = f
d.q = e
d.z = g
k.p = j
k.q = e
k.z = d
j.v = f
j.p = e
f.v = j
f.p = j
assert m.u.z.p.v.txt == "j"