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

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

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

k = A("k")
j = B("j")
c = C("c")
l = C("l")
h = B("h")
f = A("f")
m = A("m")
d = C("d")
e = A("e")
n = A("n")

k.y = c
k.u = m
j.p = h
j.r = l
c.y = k
l.y = m
h.p = j
h.r = c
f.y = l
f.u = n
m.y = l
m.u = e
d.y = k
e.y = d
e.u = m
n.y = d
n.u = f
assert l.y.u.u.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: A = None
        self.txt = txt

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

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

k = A("k")
j = B("j")
c = C("c")
l = C("l")
h = B("h")
f = A("f")
m = A("m")
d = C("d")
e = A("e")
n = A("n")

k.y = c
k.u = m
j.p = h
j.r = l
c.y = k
l.y = m
h.p = j
h.r = c
f.y = l
f.u = n
m.y = l
m.u = e
d.y = k
e.y = d
e.u = m
n.y = d
n.u = f
assert l.y.u.u.u.y.txt == "d"