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

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

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

d = A("d")
j = B("j")
g = C("g")
l = C("l")
h = B("h")
a = C("a")
k = C("k")

d.t = g
j.y = h
g.y = j
g.u = k
g.p = k
l.y = j
l.u = g
l.p = k
h.y = j
a.y = h
a.u = l
a.p = k
k.y = h
k.u = l
k.p = g
assert d.t.u.p.p.p.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

d = A("d")
j = B("j")
g = C("g")
l = C("l")
h = B("h")
a = C("a")
k = C("k")

d.t = g
j.y = h
g.y = j
g.u = k
g.p = k
l.y = j
l.u = g
l.p = k
h.y = j
a.y = h
a.u = l
a.p = k
k.y = h
k.u = l
k.p = g
assert d.t.u.p.p.p.y.y.txt == "h"