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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: D = None
        self.y: D = None
        self.x: D = None
        self.txt = txt

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

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

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

i.q = a
c.q = i
c.p = j
c.x = j
c.y = f
m.v = e
m.q = e
m.x = i
m.r = a
f.r = e
f.t = c
f.s = j
f.z = i
a.q = i
a.p = f
a.y = f
a.x = j
e.v = m
e.q = m
e.x = i
e.r = a
k.q = i
k.p = j
k.y = j
k.x = j
j.r = m
j.t = c
j.s = f
j.z = i
assert m.q.x.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.p: D = None
        self.y: D = None
        self.x: D = None
        self.txt = txt

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

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

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

i.q = a
c.q = i
c.p = j
c.x = j
c.y = f
m.v = e
m.q = e
m.x = i
m.r = a
f.r = e
f.t = c
f.s = j
f.z = i
a.q = i
a.p = f
a.y = f
a.x = j
e.v = m
e.q = m
e.x = i
e.r = a
k.q = i
k.p = j
k.y = j
k.x = j
j.r = m
j.t = c
j.s = f
j.z = i
assert m.q.x.q.q.q.txt == "a"