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

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

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

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

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

i.o = e
i.x = h
i.p = f
l.t = h
f.x = l
h.r = m
h.u = m
h.w = e
h.s = l
m.x = l
e.r = m
e.w = h
e.u = f
e.s = l
assert i.p.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.x: D = None
        self.p: C = None
        self.txt = txt

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

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

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

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

i.o = e
i.x = h
i.p = f
l.t = h
f.x = l
h.r = m
h.u = m
h.w = e
h.s = l
m.x = l
e.r = m
e.w = h
e.u = f
e.s = l
assert i.p.x.t.txt == "h"