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

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

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

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

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

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

k.x = c
k.w = f
m.r = f
m.z = i
c.t = m
i.o = j
i.y = m
e.y = i
e.w = m
e.q = j
j.y = i
j.w = m
j.q = e
f.x = c
f.w = k
assert e.q.q.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

k.x = c
k.w = f
m.r = f
m.z = i
c.t = m
i.o = j
i.y = m
e.y = i
e.w = m
e.q = j
j.y = i
j.w = m
j.q = e
f.x = c
f.w = k
assert e.q.q.w.txt == "m"