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

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

e = A("e")
i = B("i")
d = B("d")
l = A("l")
a = A("a")
f = A("f")
c = A("c")
m = B("m")
k = B("k")
n = A("n")

e.u = l
e.r = c
i.t = e
i.v = d
d.t = e
d.v = k
l.u = e
l.r = e
a.u = n
a.r = c
f.u = c
f.r = a
c.u = l
c.r = a
m.t = e
m.v = k
k.t = c
k.v = i
n.u = f
n.r = a
assert c.r.r.u.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.r: A = None
        self.txt = txt

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

e = A("e")
i = B("i")
d = B("d")
l = A("l")
a = A("a")
f = A("f")
c = A("c")
m = B("m")
k = B("k")
n = A("n")

e.u = l
e.r = c
i.t = e
i.v = d
d.t = e
d.v = k
l.u = e
l.r = e
a.u = n
a.r = c
f.u = c
f.r = a
c.u = l
c.r = a
m.t = e
m.v = k
k.t = c
k.v = i
n.u = f
n.r = a
assert c.r.r.u.r.r.r.r.txt == "c"