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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.s: C = None
        self.w: D = None
        self.p: D = None
        self.txt = txt

i = A("i")
j = B("j")
k = C("k")
l = D("l")
g = E("g")
b = D("b")
c = A("c")
d = C("d")

i.w = c
j.q = c
j.o = c
j.z = c
j.s = d
j.y = g
k.s = i
l.z = j
g.t = j
g.x = b
g.w = b
g.p = b
g.s = k
b.z = j
c.w = i
d.s = i
assert k.s.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.s: C = None
        self.w: D = None
        self.p: D = None
        self.txt = txt

i = A("i")
j = B("j")
k = C("k")
l = D("l")
g = E("g")
b = D("b")
c = A("c")
d = C("d")

i.w = c
j.q = c
j.o = c
j.z = c
j.s = d
j.y = g
k.s = i
l.z = j
g.t = j
g.x = b
g.w = b
g.p = b
g.s = k
b.z = j
c.w = i
d.s = i
assert k.s.w.w.w.txt == "c"