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

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

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

l = A("l")
m = B("m")
e = C("e")
b = B("b")
n = B("n")
j = A("j")

l.p = b
m.u = b
m.t = e
e.q = l
b.u = n
b.t = e
n.u = b
n.t = e
j.p = n
assert m.u.t.q.p.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

l = A("l")
m = B("m")
e = C("e")
b = B("b")
n = B("n")
j = A("j")

l.p = b
m.u = b
m.t = e
e.q = l
b.u = n
b.t = e
n.u = b
n.t = e
j.p = n
assert m.u.t.q.p.u.u.txt == "b"