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

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

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

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

a = A("a")
j = B("j")
h = C("h")
c = D("c")
b = A("b")
f = D("f")
n = C("n")

a.s = c
a.r = b
a.x = n
a.z = j
j.q = n
j.y = a
h.u = n
c.x = j
c.z = f
c.o = b
b.s = f
b.r = a
b.x = n
b.z = j
f.x = j
f.z = c
f.o = a
n.u = h
assert c.o.r.x.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.r: A = None
        self.x: C = None
        self.z: B = None
        self.txt = txt

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

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

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

a = A("a")
j = B("j")
h = C("h")
c = D("c")
b = A("b")
f = D("f")
n = C("n")

a.s = c
a.r = b
a.x = n
a.z = j
j.q = n
j.y = a
h.u = n
c.x = j
c.z = f
c.o = b
b.s = f
b.r = a
b.x = n
b.z = j
f.x = j
f.z = c
f.o = a
n.u = h
assert c.o.r.x.u.u.u.txt == "h"