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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: A = None
        self.o: D = 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.v: A = None
        self.w: A = None
        self.t: B = None
        self.o: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: C = None
        self.x: A = None
        self.o: D = 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.v: A = None
        self.w: A = None
        self.t: B = None
        self.o: A = None
        self.txt = txt

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

c.u = k
c.p = k
c.q = m
c.o = n
d.s = k
d.x = n
d.o = m
k.s = d
k.q = c
m.v = c
m.w = c
m.t = d
m.o = f
f.u = k
f.p = k
f.q = m
f.o = c
n.u = k
n.p = k
n.q = m
n.o = f
assert k.q.q.o.u.q.q.txt == "m"