class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: C = None
        self.y: B = None
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: D = None
        self.u: D = None
        self.txt = txt

i = A("i")
b = B("b")
c = C("c")
g = D("g")
k = E("k")
m = D("m")

i.z = g
i.x = g
i.o = c
i.y = b
i.r = k
b.u = i
c.q = i
g.o = k
g.q = b
g.v = b
k.o = b
k.w = m
k.u = g
m.o = k
m.q = b
m.v = b
assert m.q.u.r.u.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: C = None
        self.y: B = None
        self.x: D = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.w: D = None
        self.u: D = None
        self.txt = txt

i = A("i")
b = B("b")
c = C("c")
g = D("g")
k = E("k")
m = D("m")

i.z = g
i.x = g
i.o = c
i.y = b
i.r = k
b.u = i
c.q = i
g.o = k
g.q = b
g.v = b
k.o = b
k.w = m
k.u = g
m.o = k
m.q = b
m.v = b
assert m.q.u.r.u.v.u.txt == "i"