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

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

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

l = A("l")
f = B("f")
c = C("c")
d = B("d")
n = A("n")
j = A("j")

l.o = n
l.u = f
l.z = f
f.v = d
f.o = c
c.p = l
c.t = d
d.v = f
d.o = c
n.o = l
n.u = f
n.z = d
j.o = l
j.u = f
j.z = f
assert c.t.v.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: B = None
        self.z: B = None
        self.txt = txt

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

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

l = A("l")
f = B("f")
c = C("c")
d = B("d")
n = A("n")
j = A("j")

l.o = n
l.u = f
l.z = f
f.v = d
f.o = c
c.p = l
c.t = d
d.v = f
d.o = c
n.o = l
n.u = f
n.z = d
j.o = l
j.u = f
j.z = f
assert c.t.v.o.txt == "c"