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

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

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

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

h = A("h")
m = B("m")
b = C("b")
e = D("e")
l = A("l")
d = B("d")
j = D("j")
k = C("k")

h.z = d
h.o = d
h.s = j
h.x = k
m.x = l
m.q = e
m.o = d
b.p = j
e.o = m
l.z = d
l.s = e
l.o = m
l.x = b
d.x = l
d.q = j
d.o = m
j.o = d
k.p = j
assert e.o.q.o.o.x.z.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.s: D = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

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

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

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

h = A("h")
m = B("m")
b = C("b")
e = D("e")
l = A("l")
d = B("d")
j = D("j")
k = C("k")

h.z = d
h.o = d
h.s = j
h.x = k
m.x = l
m.q = e
m.o = d
b.p = j
e.o = m
l.z = d
l.s = e
l.o = m
l.x = b
d.x = l
d.q = j
d.o = m
j.o = d
k.p = j
assert e.o.q.o.o.x.z.q.txt == "j"