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

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

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

c = A("c")
h = B("h")
d = C("d")
e = B("e")
j = C("j")
a = C("a")
g = A("g")

c.x = e
c.u = g
h.o = j
h.t = g
d.v = h
d.z = c
e.o = j
e.t = g
j.v = e
j.z = c
a.v = e
a.z = g
g.x = e
g.u = c
assert c.u.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: A = None
        self.txt = txt

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

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

c = A("c")
h = B("h")
d = C("d")
e = B("e")
j = C("j")
a = C("a")
g = A("g")

c.x = e
c.u = g
h.o = j
h.t = g
d.v = h
d.z = c
e.o = j
e.t = g
j.v = e
j.z = c
a.v = e
a.z = g
g.x = e
g.u = c
assert c.u.u.u.u.txt == "c"