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

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

e = A("e")
d = B("d")
i = A("i")
f = A("f")
n = B("n")
c = A("c")
b = B("b")
l = A("l")
j = A("j")
k = A("k")

e.u = n
e.r = k
d.p = e
d.t = n
i.u = n
i.r = c
f.u = n
f.r = i
n.p = l
n.t = d
c.u = n
c.r = k
b.p = k
b.t = n
l.u = n
l.r = j
j.u = b
j.r = k
k.u = n
k.r = f
assert n.t.p.r.r.r.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: A = None
        self.txt = txt

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

e = A("e")
d = B("d")
i = A("i")
f = A("f")
n = B("n")
c = A("c")
b = B("b")
l = A("l")
j = A("j")
k = A("k")

e.u = n
e.r = k
d.p = e
d.t = n
i.u = n
i.r = c
f.u = n
f.r = i
n.p = l
n.t = d
c.u = n
c.r = k
b.p = k
b.t = n
l.u = n
l.r = j
j.u = b
j.r = k
k.u = n
k.r = f
assert n.t.p.r.r.r.r.u.txt == "n"