class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
c = C("c")
m = D("m")
k = E("k")
f = E("f")

i.o = c
i.w = c
i.r = j
j.r = i
c.w = m
c.s = f
c.z = i
c.v = j
m.w = i
m.v = k
k.v = i
k.u = i
f.v = i
f.u = i
assert k.v.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.w: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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

i = A("i")
j = B("j")
c = C("c")
m = D("m")
k = E("k")
f = E("f")

i.o = c
i.w = c
i.r = j
j.r = i
c.w = m
c.s = f
c.z = i
c.v = j
m.w = i
m.v = k
k.v = i
k.u = i
f.v = i
f.u = i
assert k.v.w.w.w.txt == "i"