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

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

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

b = A("b")
g = B("g")
f = C("f")
c = C("c")
h = B("h")
a = C("a")
j = B("j")
m = B("m")
k = C("k")

b.u = g
b.s = g
g.v = k
f.z = h
f.u = m
c.z = m
c.u = j
h.v = a
a.z = m
a.u = m
j.v = a
m.v = a
k.z = h
k.u = m
assert j.v.z.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: B = None
        self.txt = txt

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

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

b = A("b")
g = B("g")
f = C("f")
c = C("c")
h = B("h")
a = C("a")
j = B("j")
m = B("m")
k = C("k")

b.u = g
b.s = g
g.v = k
f.z = h
f.u = m
c.z = m
c.u = j
h.v = a
a.z = m
a.u = m
j.v = a
m.v = a
k.z = h
k.u = m
assert j.v.z.v.u.txt == "m"