class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

l = A("l")
g = B("g")
f = C("f")
b = D("b")
e = D("e")
h = C("h")
j = D("j")
m = A("m")
a = B("a")
c = C("c")

l.v = j
g.u = b
g.o = e
g.t = a
g.z = l
f.t = a
f.s = g
b.q = g
e.q = g
h.t = g
h.s = a
j.q = a
m.v = b
a.u = j
a.o = b
a.t = g
a.z = m
c.t = a
c.s = a
assert g.t.t.z.v.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

l = A("l")
g = B("g")
f = C("f")
b = D("b")
e = D("e")
h = C("h")
j = D("j")
m = A("m")
a = B("a")
c = C("c")

l.v = j
g.u = b
g.o = e
g.t = a
g.z = l
f.t = a
f.s = g
b.q = g
e.q = g
h.t = g
h.s = a
j.q = a
m.v = b
a.u = j
a.o = b
a.t = g
a.z = m
c.t = a
c.s = a
assert g.t.t.z.v.q.z.txt == "m"