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

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

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

l = A("l")
d = B("d")
c = C("c")
b = C("b")
j = A("j")
g = B("g")
n = C("n")
e = B("e")

l.t = b
l.y = j
l.x = g
d.w = l
d.u = j
d.p = b
c.u = b
c.p = d
b.u = n
b.p = e
j.t = n
j.y = l
j.x = e
g.w = j
g.u = l
g.p = c
n.u = c
n.p = d
e.w = l
e.u = l
e.p = b
assert l.t.u.p.p.p.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.y: A = None
        self.x: B = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
c = C("c")
b = C("b")
j = A("j")
g = B("g")
n = C("n")
e = B("e")

l.t = b
l.y = j
l.x = g
d.w = l
d.u = j
d.p = b
c.u = b
c.p = d
b.u = n
b.p = e
j.t = n
j.y = l
j.x = e
g.w = j
g.u = l
g.p = c
n.u = c
n.p = d
e.w = l
e.u = l
e.p = b
assert l.t.u.p.p.p.u.y.txt == "j"