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

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

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

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

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

l = A("l")
c = B("c")
b = C("b")
e = D("e")
n = E("n")
h = B("h")

l.v = c
l.o = n
c.u = l
c.v = h
c.t = h
c.q = b
b.t = n
e.r = b
e.y = h
n.p = b
h.u = l
h.v = c
h.t = c
h.q = b
assert n.p.t.p.t.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.o: E = None
        self.txt = txt

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

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

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

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

l = A("l")
c = B("c")
b = C("b")
e = D("e")
n = E("n")
h = B("h")

l.v = c
l.o = n
c.u = l
c.v = h
c.t = h
c.q = b
b.t = n
e.r = b
e.y = h
n.p = b
h.u = l
h.v = c
h.t = c
h.q = b
assert n.p.t.p.t.p.t.txt == "n"