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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: E = None
        self.s: F = None
        self.y: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: E = None
        self.p: C = None
        self.txt = txt

b = A("b")
k = B("k")
l = C("l")
n = D("n")
a = E("a")
g = F("g")
d = E("d")

b.v = k
b.x = k
b.r = n
k.v = a
k.u = n
l.u = g
l.v = k
l.o = b
n.q = k
a.v = d
a.r = d
a.x = l
a.s = g
a.y = b
g.o = a
g.v = d
g.p = l
d.v = a
d.r = a
d.x = l
d.s = g
d.y = b
assert n.q.v.s.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: D = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: E = None
        self.x: C = None
        self.r: E = None
        self.s: F = None
        self.y: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: E = None
        self.p: C = None
        self.txt = txt

b = A("b")
k = B("k")
l = C("l")
n = D("n")
a = E("a")
g = F("g")
d = E("d")

b.v = k
b.x = k
b.r = n
k.v = a
k.u = n
l.u = g
l.v = k
l.o = b
n.q = k
a.v = d
a.r = d
a.x = l
a.s = g
a.y = b
g.o = a
g.v = d
g.p = l
d.v = a
d.r = a
d.x = l
d.s = g
d.y = b
assert n.q.v.s.txt == "g"