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

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

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

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

b = A("b")
m = B("m")
f = C("f")
j = D("j")
g = A("g")
i = D("i")
k = C("k")
c = D("c")

b.v = g
b.u = g
b.o = m
b.q = m
m.v = c
m.x = k
f.s = k
f.y = m
f.q = g
j.q = g
j.p = c
j.z = b
g.v = b
g.u = b
g.o = m
g.q = m
i.q = b
i.p = j
i.z = g
k.s = f
k.y = m
k.q = b
c.q = g
c.z = g
c.p = i
assert c.p.q.q.x.s.s.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: B = None
        self.q: B = None
        self.u: A = None
        self.txt = txt

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

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

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

b = A("b")
m = B("m")
f = C("f")
j = D("j")
g = A("g")
i = D("i")
k = C("k")
c = D("c")

b.v = g
b.u = g
b.o = m
b.q = m
m.v = c
m.x = k
f.s = k
f.y = m
f.q = g
j.q = g
j.p = c
j.z = b
g.v = b
g.u = b
g.o = m
g.q = m
i.q = b
i.p = j
i.z = g
k.s = f
k.y = m
k.q = b
c.q = g
c.z = g
c.p = i
assert c.p.q.q.x.s.s.q.q.txt == "m"