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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.s: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: D = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: B = None
        self.r: D = None
        self.q: D = None
        self.w: G = None
        self.p: E = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: F = None
        self.r: C = None
        self.txt = txt

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

k.r = m
l.o = m
l.r = m
l.s = g
m.p = n
a.s = g
a.x = b
a.q = b
n.u = k
n.s = k
n.t = g
i.v = m
i.s = l
i.r = b
i.q = a
i.w = g
i.p = n
i.o = k
g.p = l
g.v = i
g.r = m
b.s = g
b.x = a
b.q = a
assert k.r.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.s: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: D = None
        self.q: D = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.t: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: B = None
        self.r: D = None
        self.q: D = None
        self.w: G = None
        self.p: E = None
        self.o: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.v: F = None
        self.r: C = None
        self.txt = txt

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

k.r = m
l.o = m
l.r = m
l.s = g
m.p = n
a.s = g
a.x = b
a.q = b
n.u = k
n.s = k
n.t = g
i.v = m
i.s = l
i.r = b
i.q = a
i.w = g
i.p = n
i.o = k
g.p = l
g.v = i
g.r = m
b.s = g
b.x = a
b.q = a
assert k.r.p.s.txt == "k"