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

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

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

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

i = A("i")
l = B("l")
h = C("h")
f = D("f")
e = D("e")
n = C("n")
m = A("m")

i.r = l
i.x = l
i.v = l
i.s = m
l.q = h
h.p = f
h.t = m
h.x = n
f.p = l
f.x = m
f.o = h
f.t = h
e.p = l
e.x = i
e.o = h
e.t = h
n.p = f
n.t = i
n.x = h
m.r = l
m.x = l
m.v = l
m.s = i
assert f.x.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.v: B = None
        self.s: A = None
        self.txt = txt

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

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

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

i = A("i")
l = B("l")
h = C("h")
f = D("f")
e = D("e")
n = C("n")
m = A("m")

i.r = l
i.x = l
i.v = l
i.s = m
l.q = h
h.p = f
h.t = m
h.x = n
f.p = l
f.x = m
f.o = h
f.t = h
e.p = l
e.x = i
e.o = h
e.t = h
n.p = f
n.t = i
n.x = h
m.r = l
m.x = l
m.v = l
m.s = i
assert f.x.s.x.txt == "l"