class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.r: A = None
        self.o: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

f.u = k
f.r = b
f.o = b
f.w = b
a.q = k
l.t = a
k.o = b
k.p = l
k.y = f
i.t = e
c.t = e
b.u = k
b.r = f
b.o = f
b.w = f
e.q = k
assert c.t.q.o.u.p.t.q.txt == "k"