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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

l = A("l")
d = B("d")
j = C("j")
n = D("n")
i = E("i")
e = A("e")
k = D("k")
h = A("h")

l.r = h
l.p = h
l.t = j
d.v = j
j.p = e
j.t = l
n.r = j
n.y = d
n.p = l
i.s = j
i.v = n
i.o = n
e.r = l
e.p = l
e.t = j
k.r = j
k.y = d
k.p = h
h.r = e
h.t = j
h.p = l
assert l.t.t.t.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.t: C = None
        self.p: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: D = None
        self.o: D = None
        self.txt = txt

l = A("l")
d = B("d")
j = C("j")
n = D("n")
i = E("i")
e = A("e")
k = D("k")
h = A("h")

l.r = h
l.p = h
l.t = j
d.v = j
j.p = e
j.t = l
n.r = j
n.y = d
n.p = l
i.s = j
i.v = n
i.o = n
e.r = l
e.p = l
e.t = j
k.r = j
k.y = d
k.p = h
h.r = e
h.t = j
h.p = l
assert l.t.t.t.p.t.p.t.txt == "j"