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

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

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

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

b = A("b")
i = B("i")
a = C("a")
j = D("j")
f = D("f")
k = A("k")
m = B("m")

b.o = j
b.z = k
b.v = a
i.x = b
i.r = k
i.s = k
i.t = f
a.r = j
a.t = m
a.o = b
a.s = f
j.u = k
j.s = f
j.y = m
j.x = m
f.u = b
f.s = j
f.y = i
f.x = i
k.o = j
k.z = b
k.v = a
m.x = k
m.r = k
m.s = k
m.t = f
assert j.u.z.z.o.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.z: A = None
        self.v: C = None
        self.txt = txt

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

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

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

b = A("b")
i = B("i")
a = C("a")
j = D("j")
f = D("f")
k = A("k")
m = B("m")

b.o = j
b.z = k
b.v = a
i.x = b
i.r = k
i.s = k
i.t = f
a.r = j
a.t = m
a.o = b
a.s = f
j.u = k
j.s = f
j.y = m
j.x = m
f.u = b
f.s = j
f.y = i
f.x = i
k.o = j
k.z = b
k.v = a
m.x = k
m.r = k
m.s = k
m.t = f
assert j.u.z.z.o.s.txt == "f"