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

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

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

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

k = A("k")
m = B("m")
a = C("a")
b = D("b")
d = D("d")
i = C("i")
c = A("c")

k.q = b
k.o = b
k.u = c
m.s = d
m.w = k
m.p = i
a.v = i
a.y = b
b.s = d
b.z = d
b.r = c
b.v = a
d.s = b
d.z = b
d.r = c
d.v = a
i.v = a
i.y = d
c.q = b
c.u = k
c.o = d
assert d.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: A = None
        self.o: D = None
        self.txt = txt

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

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

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

k = A("k")
m = B("m")
a = C("a")
b = D("b")
d = D("d")
i = C("i")
c = A("c")

k.q = b
k.o = b
k.u = c
m.s = d
m.w = k
m.p = i
a.v = i
a.y = b
b.s = d
b.z = d
b.r = c
b.v = a
d.s = b
d.z = b
d.r = c
d.v = a
i.v = a
i.y = d
c.q = b
c.u = k
c.o = d
assert d.v.v.v.txt == "a"