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

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

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

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

a = A("a")
i = B("i")
k = C("k")
f = D("f")
e = A("e")
c = B("c")
d = D("d")
j = B("j")
n = D("n")
b = D("b")

a.u = d
a.t = k
a.x = k
a.o = f
i.p = a
i.o = k
k.s = c
k.q = a
f.o = n
e.u = b
e.t = k
e.x = k
e.o = n
c.p = a
c.o = k
d.o = n
j.p = a
j.o = k
n.o = d
b.o = d
assert e.x.q.u.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.x: C = None
        self.o: D = None
        self.txt = txt

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

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

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

a = A("a")
i = B("i")
k = C("k")
f = D("f")
e = A("e")
c = B("c")
d = D("d")
j = B("j")
n = D("n")
b = D("b")

a.u = d
a.t = k
a.x = k
a.o = f
i.p = a
i.o = k
k.s = c
k.q = a
f.o = n
e.u = b
e.t = k
e.x = k
e.o = n
c.p = a
c.o = k
d.o = n
j.p = a
j.o = k
n.o = d
b.o = d
assert e.x.q.u.o.o.o.o.o.o.txt == "d"