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

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

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

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

k = A("k")
c = B("c")
f = C("f")
g = D("g")
a = C("a")
m = B("m")
n = D("n")
l = D("l")

k.q = m
c.u = a
c.z = f
f.v = g
f.w = a
f.p = a
f.t = m
g.o = k
g.x = k
g.q = l
a.v = g
a.w = f
a.p = f
a.t = c
m.u = a
m.z = f
n.o = k
n.x = k
n.q = l
l.o = k
l.x = k
l.q = n
assert g.q.q.o.q.z.p.v.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
f = C("f")
g = D("g")
a = C("a")
m = B("m")
n = D("n")
l = D("l")

k.q = m
c.u = a
c.z = f
f.v = g
f.w = a
f.p = a
f.t = m
g.o = k
g.x = k
g.q = l
a.v = g
a.w = f
a.p = f
a.t = c
m.u = a
m.z = f
n.o = k
n.x = k
n.q = l
l.o = k
l.x = k
l.q = n
assert g.q.q.o.q.z.p.v.x.txt == "k"