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

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: A = None
        self.s: B = None
        self.txt = txt

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

a.z = g
a.t = g
a.v = h
a.o = h
l.o = h
l.y = i
i.o = g
i.w = g
i.v = g
i.q = l
h.v = g
h.q = a
h.s = l
g.z = a
g.t = a
g.v = h
g.o = h
assert i.v.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.v: D = None
        self.t: A = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: A = None
        self.s: B = None
        self.txt = txt

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

a.z = g
a.t = g
a.v = h
a.o = h
l.o = h
l.y = i
i.o = g
i.w = g
i.v = g
i.q = l
h.v = g
h.q = a
h.s = l
g.z = a
g.t = a
g.v = h
g.o = h
assert i.v.t.o.txt == "h"