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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: B = None
        self.q: B = None
        self.txt = txt

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

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

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

i.q = f
l.t = n
l.q = n
l.w = d
l.v = d
l.x = f
f.w = l
f.s = l
f.q = l
d.z = f
d.w = f
d.u = i
j.y = m
j.o = i
j.w = i
j.r = f
n.q = f
m.y = j
m.o = n
m.w = i
m.r = f
assert d.w.q.q.q.txt == "f"