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

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

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

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

f = A("f")
m = B("m")
g = C("g")
j = D("j")
k = C("k")
l = D("l")
e = C("e")
i = D("i")
b = D("b")
n = A("n")

f.q = m
f.p = m
f.x = k
f.r = n
m.p = f
m.z = e
m.r = e
m.q = i
g.w = k
g.v = m
j.q = e
j.x = m
j.z = k
j.r = f
k.w = e
k.v = m
l.q = e
l.x = m
l.z = g
l.r = n
e.w = g
e.v = m
i.q = g
i.x = m
i.z = e
i.r = f
b.q = e
b.z = e
b.x = m
b.r = f
n.q = m
n.p = m
n.x = g
n.r = f
assert n.x.v.q.q.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.x: C = None
        self.r: A = None
        self.txt = txt

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

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

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

f = A("f")
m = B("m")
g = C("g")
j = D("j")
k = C("k")
l = D("l")
e = C("e")
i = D("i")
b = D("b")
n = A("n")

f.q = m
f.p = m
f.x = k
f.r = n
m.p = f
m.z = e
m.r = e
m.q = i
g.w = k
g.v = m
j.q = e
j.x = m
j.z = k
j.r = f
k.w = e
k.v = m
l.q = e
l.x = m
l.z = g
l.r = n
e.w = g
e.v = m
i.q = g
i.x = m
i.z = e
i.r = f
b.q = e
b.z = e
b.x = m
b.r = f
n.q = m
n.p = m
n.x = g
n.r = f
assert n.x.v.q.q.v.z.txt == "e"