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

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

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

a = A("a")
n = B("n")
l = C("l")
i = A("i")
b = B("b")
m = A("m")
f = A("f")
e = A("e")

a.r = b
n.z = l
n.q = l
n.t = f
l.u = n
l.v = n
l.z = a
i.r = n
b.z = l
b.q = l
b.t = i
m.r = n
f.r = b
e.r = b
assert a.r.t.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

a = A("a")
n = B("n")
l = C("l")
i = A("i")
b = B("b")
m = A("m")
f = A("f")
e = A("e")

a.r = b
n.z = l
n.q = l
n.t = f
l.u = n
l.v = n
l.z = a
i.r = n
b.z = l
b.q = l
b.t = i
m.r = n
f.r = b
e.r = b
assert a.r.t.r.z.txt == "l"