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

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

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

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

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

i.r = a
i.v = l
a.s = i
a.z = i
l.r = h
l.w = h
l.z = c
h.q = l
h.s = l
h.v = a
h.r = c
c.r = h
c.w = h
c.z = l
assert l.z.z.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

i.r = a
i.v = l
a.s = i
a.z = i
l.r = h
l.w = h
l.z = c
h.q = l
h.s = l
h.v = a
h.r = c
c.r = h
c.w = h
c.z = l
assert l.z.z.z.w.txt == "h"