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

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

d = A("d")
c = B("c")
j = C("j")
a = D("a")
m = C("m")
n = A("n")
g = D("g")
f = C("f")
l = A("l")

d.o = j
c.z = f
c.w = a
c.p = n
j.s = m
j.z = f
j.t = d
a.p = j
a.o = j
a.x = g
m.s = j
m.z = f
m.t = l
n.o = j
g.p = f
g.o = f
g.x = a
f.s = m
f.z = j
f.t = n
l.o = j
assert g.x.o.t.o.z.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

d = A("d")
c = B("c")
j = C("j")
a = D("a")
m = C("m")
n = A("n")
g = D("g")
f = C("f")
l = A("l")

d.o = j
c.z = f
c.w = a
c.p = n
j.s = m
j.z = f
j.t = d
a.p = j
a.o = j
a.x = g
m.s = j
m.z = f
m.t = l
n.o = j
g.p = f
g.o = f
g.x = a
f.s = m
f.z = j
f.t = n
l.o = j
assert g.x.o.t.o.z.t.o.txt == "j"