class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.u: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: F = None
        self.y: G = None
        self.p: A = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: A = None
        self.txt = txt

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

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

h.r = g
h.u = i
k.v = m
k.y = f
f.q = m
f.s = k
m.y = l
m.x = l
m.o = i
m.r = k
m.s = f
l.u = g
l.y = g
l.o = i
l.s = i
l.p = h
l.x = f
i.u = l
i.z = h
g.z = a
g.q = m
g.r = h
a.z = g
a.q = m
a.r = h
assert g.z.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.u: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.o: F = None
        self.y: G = None
        self.p: A = None
        self.x: C = None
        self.s: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.z: A = None
        self.txt = txt

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

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

h.r = g
h.u = i
k.v = m
k.y = f
f.q = m
f.s = k
m.y = l
m.x = l
m.o = i
m.r = k
m.s = f
l.u = g
l.y = g
l.o = i
l.s = i
l.p = h
l.x = f
i.u = l
i.z = h
g.z = a
g.q = m
g.r = h
a.z = g
a.q = m
a.r = h
assert g.z.q.r.txt == "k"