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

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

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

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

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

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

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

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

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

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

k.s = e
k.q = f
k.r = f
k.v = d
a.o = f
e.u = f
j.x = e
n.u = f
f.x = e
c.o = f
m.s = e
m.q = j
m.v = d
m.r = f
d.s = e
d.q = f
d.r = f
d.v = m
assert d.q.x.u.x.txt == "e"