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

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

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

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

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

g.z = l
g.o = h
j.x = g
j.o = l
j.z = h
a.r = l
a.o = g
a.q = j
a.u = e
h.x = e
e.r = g
e.o = g
e.q = j
e.u = a
b.x = l
b.o = g
b.z = h
l.z = g
l.o = h
assert l.o.x.q.x.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.o: D = None
        self.txt = txt

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

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

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

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

g.z = l
g.o = h
j.x = g
j.o = l
j.z = h
a.r = l
a.o = g
a.q = j
a.u = e
h.x = e
e.r = g
e.o = g
e.q = j
e.u = a
b.x = l
b.o = g
b.z = h
l.z = g
l.o = h
assert l.o.x.q.x.z.o.txt == "h"