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

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

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

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

e = A("e")
i = B("i")
l = C("l")
c = D("c")
d = C("d")
f = B("f")
b = A("b")
a = C("a")

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

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

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

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

e = A("e")
i = B("i")
l = C("l")
c = D("c")
d = C("d")
f = B("f")
b = A("b")
a = C("a")

e.y = f
e.p = b
i.t = d
l.r = a
l.u = i
c.r = a
c.t = f
d.r = l
d.u = i
f.t = d
b.y = i
b.p = e
a.r = d
a.u = i
assert d.u.t.u.t.r.u.t.txt == "d"