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

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

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

c = A("c")
l = B("l")
e = C("e")
g = C("g")
h = C("h")
j = C("j")
m = A("m")

c.z = m
c.p = m
c.u = l
l.o = c
e.y = l
e.p = h
g.y = l
g.p = j
h.y = l
h.p = j
j.y = l
j.p = e
m.z = c
m.p = c
m.u = l
assert c.u.o.u.o.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: A = None
        self.u: B = None
        self.txt = txt

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

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

c = A("c")
l = B("l")
e = C("e")
g = C("g")
h = C("h")
j = C("j")
m = A("m")

c.z = m
c.p = m
c.u = l
l.o = c
e.y = l
e.p = h
g.y = l
g.p = j
h.y = l
h.p = j
j.y = l
j.p = e
m.z = c
m.p = c
m.u = l
assert c.u.o.u.o.u.o.txt == "c"