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

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

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

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

i = A("i")
m = B("m")
l = C("l")
c = D("c")
k = A("k")
h = B("h")

i.o = h
i.t = c
m.z = h
m.u = k
m.v = l
m.o = c
l.y = k
c.u = k
c.q = l
k.o = m
k.t = c
h.z = m
h.u = k
h.v = l
h.o = c
assert h.z.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: D = None
        self.txt = txt

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

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

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

i = A("i")
m = B("m")
l = C("l")
c = D("c")
k = A("k")
h = B("h")

i.o = h
i.t = c
m.z = h
m.u = k
m.v = l
m.o = c
l.y = k
c.u = k
c.q = l
k.o = m
k.t = c
h.z = m
h.u = k
h.v = l
h.o = c
assert h.z.z.o.txt == "c"