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

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

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

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

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

h.o = l
h.v = l
h.r = m
m.q = k
m.u = i
l.p = i
l.x = h
l.s = h
i.r = h
i.z = k
k.p = i
k.x = h
k.s = h
assert i.r.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: B = None
        self.v: C = None
        self.txt = txt

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

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

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

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

h.o = l
h.v = l
h.r = m
m.q = k
m.u = i
l.p = i
l.x = h
l.s = h
i.r = h
i.z = k
k.p = i
k.x = h
k.s = h
assert i.r.r.u.txt == "i"