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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.s: A = None
        self.z: B = None
        self.txt = txt

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

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

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

i.u = b
b.t = i
b.x = i
n.t = l
n.x = l
n.s = i
n.z = b
l.q = c
l.v = n
l.w = n
l.s = i
c.w = b
c.z = l
c.y = l
c.r = l
assert n.x.s.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.s: A = None
        self.z: B = None
        self.txt = txt

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

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

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

i.u = b
b.t = i
b.x = i
n.t = l
n.x = l
n.s = i
n.z = b
l.q = c
l.v = n
l.w = n
l.s = i
c.w = b
c.z = l
c.y = l
c.r = l
assert n.x.s.u.t.txt == "i"