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

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

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

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

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

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

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

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

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

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

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