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

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

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

a = A("a")
e = B("e")
m = C("m")
d = C("d")
g = C("g")
b = B("b")
c = A("c")
l = A("l")

a.t = e
e.p = m
e.t = m
e.u = d
m.x = g
m.u = a
m.p = c
d.x = m
d.u = c
d.p = l
g.x = d
g.u = l
g.p = a
b.p = m
b.t = m
b.u = d
c.t = e
l.t = b
assert e.u.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

a = A("a")
e = B("e")
m = C("m")
d = C("d")
g = C("g")
b = B("b")
c = A("c")
l = A("l")

a.t = e
e.p = m
e.t = m
e.u = d
m.x = g
m.u = a
m.p = c
d.x = m
d.u = c
d.p = l
g.x = d
g.u = l
g.p = a
b.p = m
b.t = m
b.u = d
c.t = e
l.t = b
assert e.u.p.t.txt == "b"