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

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

n.q = c
n.s = e
n.r = f
n.o = l
l.u = d
l.p = n
l.z = i
f.y = d
e.y = d
e.t = l
i.q = h
i.r = h
i.s = e
i.o = l
d.y = e
d.t = l
c.y = d
h.y = d
assert i.s.y.t.p.s.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.s: D = None
        self.r: C = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: D = None
        self.txt = txt

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

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

n.q = c
n.s = e
n.r = f
n.o = l
l.u = d
l.p = n
l.z = i
f.y = d
e.y = d
e.t = l
i.q = h
i.r = h
i.s = e
i.o = l
d.y = e
d.t = l
c.y = d
h.y = d
assert i.s.y.t.p.s.t.p.txt == "n"