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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: C = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

g = A("g")
a = B("a")
j = C("j")
n = D("n")
e = B("e")
m = D("m")
l = A("l")
f = D("f")

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

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

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

class D:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: C = None
        self.x: D = None
        self.s: A = None
        self.txt = txt

g = A("g")
a = B("a")
j = C("j")
n = D("n")
e = B("e")
m = D("m")
l = A("l")
f = D("f")

g.z = a
g.t = n
a.o = e
a.u = g
j.p = e
j.v = g
n.u = a
n.q = j
n.x = f
n.s = g
e.o = a
e.u = g
m.u = e
m.q = j
m.x = n
m.s = g
l.z = a
l.t = m
f.u = a
f.q = j
f.x = m
f.s = l
assert l.t.q.v.txt == "g"