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

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

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

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

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

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

i.q = m
i.z = m
c.q = n
c.z = n
c.s = i
c.v = m
c.t = m
m.t = i
m.r = l
l.w = i
l.v = f
n.r = m
f.q = n
f.z = n
f.s = i
f.v = m
f.t = m
assert i.q.t.q.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

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

i.q = m
i.z = m
c.q = n
c.z = n
c.s = i
c.v = m
c.t = m
m.t = i
m.r = l
l.w = i
l.v = f
n.r = m
f.q = n
f.z = n
f.s = i
f.v = m
f.t = m
assert i.q.t.q.r.w.txt == "i"