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

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

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

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

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

g.p = b
g.v = n
g.o = h
a.o = f
a.x = f
a.v = n
f.u = e
f.x = n
f.z = n
f.q = b
e.t = d
e.q = d
e.v = c
e.x = g
n.u = d
n.x = f
n.z = f
n.q = g
d.t = e
d.q = e
d.v = l
d.x = b
l.o = n
l.x = n
l.v = f
h.p = b
h.v = f
h.o = g
b.p = h
b.v = n
b.o = g
c.o = n
c.v = n
c.x = f
assert l.o.u.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: C = None
        self.o: A = None
        self.txt = txt

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

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

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

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

g.p = b
g.v = n
g.o = h
a.o = f
a.x = f
a.v = n
f.u = e
f.x = n
f.z = n
f.q = b
e.t = d
e.q = d
e.v = c
e.x = g
n.u = d
n.x = f
n.z = f
n.q = g
d.t = e
d.q = e
d.v = l
d.x = b
l.o = n
l.x = n
l.v = f
h.p = b
h.v = f
h.o = g
b.p = h
b.v = n
b.o = g
c.o = n
c.v = n
c.x = f
assert l.o.u.x.o.txt == "g"