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

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

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

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

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

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

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

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

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

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

a.x = h
a.v = j
i.w = a
i.s = h
h.o = f
h.t = j
f.z = i
f.t = i
f.y = l
f.p = j
j.x = h
j.v = a
l.z = i
l.t = i
l.y = f
l.p = a
assert f.y.p.v.txt == "j"