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

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

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

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

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

d.o = f
d.u = f
d.t = j
d.z = n
m.u = n
m.q = k
n.y = d
n.p = i
n.z = k
i.p = a
i.o = a
i.v = j
j.o = f
j.z = f
j.t = d
j.u = n
f.y = d
f.p = a
f.z = k
a.p = i
a.o = i
a.v = j
k.u = n
k.q = m
assert m.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: A = None
        self.u: C = None
        self.z: C = None
        self.txt = txt

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

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

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

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

d.o = f
d.u = f
d.t = j
d.z = n
m.u = n
m.q = k
n.y = d
n.p = i
n.z = k
i.p = a
i.o = a
i.v = j
j.o = f
j.z = f
j.t = d
j.u = n
f.y = d
f.p = a
f.z = k
a.p = i
a.o = i
a.v = j
k.u = n
k.q = m
assert m.q.q.q.txt == "k"