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

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

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

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

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

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

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

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

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

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

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