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

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

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

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

j = A("j")
h = B("h")
e = C("e")
g = D("g")
c = A("c")
m = D("m")
l = B("l")
a = C("a")
b = A("b")
f = A("f")

j.u = f
h.t = j
e.z = a
e.u = b
g.r = e
c.u = j
m.r = e
l.t = f
a.z = e
a.u = c
b.u = c
f.u = b
assert c.u.u.u.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

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

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

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

j = A("j")
h = B("h")
e = C("e")
g = D("g")
c = A("c")
m = D("m")
l = B("l")
a = C("a")
b = A("b")
f = A("f")

j.u = f
h.t = j
e.z = a
e.u = b
g.r = e
c.u = j
m.r = e
l.t = f
a.z = e
a.u = c
b.u = c
f.u = b
assert c.u.u.u.u.u.u.u.txt == "b"