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

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

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

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

j = A("j")
l = B("l")
m = C("m")
k = D("k")
c = C("c")
d = B("d")
g = A("g")
f = C("f")
b = C("b")

j.q = g
j.u = g
j.v = c
j.t = d
l.o = k
l.q = k
l.p = m
m.t = b
m.p = b
m.z = d
k.o = f
c.t = b
c.p = b
c.z = l
d.o = k
d.q = k
d.p = c
g.q = j
g.u = j
g.v = m
g.t = l
f.t = c
f.z = l
f.p = m
b.t = c
b.z = d
b.p = f
assert b.z.p.z.o.o.p.p.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.v: C = None
        self.t: B = None
        self.u: A = None
        self.txt = txt

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

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

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

j = A("j")
l = B("l")
m = C("m")
k = D("k")
c = C("c")
d = B("d")
g = A("g")
f = C("f")
b = C("b")

j.q = g
j.u = g
j.v = c
j.t = d
l.o = k
l.q = k
l.p = m
m.t = b
m.p = b
m.z = d
k.o = f
c.t = b
c.p = b
c.z = l
d.o = k
d.q = k
d.p = c
g.q = j
g.u = j
g.v = m
g.t = l
f.t = c
f.z = l
f.p = m
b.t = c
b.z = d
b.p = f
assert b.z.p.z.o.o.p.p.p.z.txt == "l"