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

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

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

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

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

e.q = g
e.s = g
e.x = k
e.r = i
g.z = f
g.o = f
g.u = e
g.s = k
a.t = k
k.u = e
i.z = f
i.o = f
i.u = e
i.s = k
f.u = e
assert a.t.u.r.z.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.x: D = None
        self.r: B = None
        self.s: B = None
        self.txt = txt

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

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

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

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

e.q = g
e.s = g
e.x = k
e.r = i
g.z = f
g.o = f
g.u = e
g.s = k
a.t = k
k.u = e
i.z = f
i.o = f
i.u = e
i.s = k
f.u = e
assert a.t.u.r.z.u.r.txt == "i"