class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: D = None
        self.y: C = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
i = C("i")
n = D("n")
h = E("h")
f = E("f")
d = E("d")

l.t = d
l.u = n
l.p = n
l.y = i
l.q = c
c.v = l
c.t = h
c.p = f
i.z = n
n.t = l
h.r = i
h.u = i
h.q = l
h.y = l
f.r = i
f.u = i
f.q = l
f.y = l
d.r = i
d.u = i
d.q = l
d.y = l
assert f.q.u.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.u: D = None
        self.y: C = None
        self.p: D = None
        self.q: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

l = A("l")
c = B("c")
i = C("i")
n = D("n")
h = E("h")
f = E("f")
d = E("d")

l.t = d
l.u = n
l.p = n
l.y = i
l.q = c
c.v = l
c.t = h
c.p = f
i.z = n
n.t = l
h.r = i
h.u = i
h.q = l
h.y = l
f.r = i
f.u = i
f.q = l
f.y = l
d.r = i
d.u = i
d.q = l
d.y = l
assert f.q.u.t.t.txt == "d"