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

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

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

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

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

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

l.o = e
b.z = e
b.p = c
b.w = l
n.q = j
n.t = j
j.u = d
j.t = n
c.q = e
c.y = b
c.v = n
c.u = n
c.p = d
d.q = e
d.y = b
d.v = n
d.u = n
d.p = c
e.o = l
assert b.z.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

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

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

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

l.o = e
b.z = e
b.p = c
b.w = l
n.q = j
n.t = j
j.u = d
j.t = n
c.q = e
c.y = b
c.v = n
c.u = n
c.p = d
d.q = e
d.y = b
d.v = n
d.u = n
d.p = c
e.o = l
assert b.z.o.o.o.o.txt == "e"