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

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

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

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

l = A("l")
i = B("i")
a = C("a")
e = D("e")
f = C("f")
n = C("n")
k = B("k")

l.t = e
i.x = f
i.q = f
i.o = k
i.w = l
a.q = i
a.p = k
e.y = n
e.w = i
f.q = k
f.p = i
n.q = k
n.p = i
k.x = n
k.o = i
k.q = f
k.w = l
assert k.q.q.o.x.p.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

l = A("l")
i = B("i")
a = C("a")
e = D("e")
f = C("f")
n = C("n")
k = B("k")

l.t = e
i.x = f
i.q = f
i.o = k
i.w = l
a.q = i
a.p = k
e.y = n
e.w = i
f.q = k
f.p = i
n.q = k
n.p = i
k.x = n
k.o = i
k.q = f
k.w = l
assert k.q.q.o.x.p.q.p.txt == "i"