class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

j.o = n
j.t = f
j.r = h
j.p = l
l.x = f
n.w = a
n.z = a
n.s = a
n.x = l
f.t = l
f.p = l
a.w = n
a.z = n
a.s = n
a.x = l
h.o = a
h.t = f
h.r = j
h.p = l
assert a.x.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.r: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

j.o = n
j.t = f
j.r = h
j.p = l
l.x = f
n.w = a
n.z = a
n.s = a
n.x = l
f.t = l
f.p = l
a.w = n
a.z = n
a.s = n
a.x = l
h.o = a
h.t = f
h.r = j
h.p = l
assert a.x.x.t.txt == "l"