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

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

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

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

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

f.x = l
f.p = l
f.t = l
f.s = j
l.u = j
j.u = l
a.p = h
a.x = h
c.x = l
c.p = l
c.t = l
c.s = j
h.p = a
h.x = a
assert h.x.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.p: B = None
        self.s: C = None
        self.t: B = None
        self.txt = txt

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

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

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

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

f.x = l
f.p = l
f.t = l
f.s = j
l.u = j
j.u = l
a.p = h
a.x = h
c.x = l
c.p = l
c.t = l
c.s = j
h.p = a
h.x = a
assert h.x.p.p.txt == "a"