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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: H = None
        self.p: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.r: C = None
        self.w: A = None
        self.q: C = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

g = A("g")
f = B("f")
c = C("c")
l = D("l")
a = E("a")
e = F("e")
j = G("j")
m = H("m")
k = A("k")

g.r = j
g.v = j
g.s = c
f.s = c
c.u = j
c.p = a
l.q = m
a.o = c
a.p = c
a.x = m
a.y = g
e.q = k
e.y = m
e.p = f
j.o = l
j.t = l
j.y = g
j.r = c
j.q = c
j.w = k
m.p = e
k.r = j
k.v = j
k.s = c
assert m.p.p.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: C = None
        self.v: G = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.y: H = None
        self.p: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.y: A = None
        self.r: C = None
        self.w: A = None
        self.q: C = None
        self.t: D = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

g = A("g")
f = B("f")
c = C("c")
l = D("l")
a = E("a")
e = F("e")
j = G("j")
m = H("m")
k = A("k")

g.r = j
g.v = j
g.s = c
f.s = c
c.u = j
c.p = a
l.q = m
a.o = c
a.p = c
a.x = m
a.y = g
e.q = k
e.y = m
e.p = f
j.o = l
j.t = l
j.y = g
j.r = c
j.q = c
j.w = k
m.p = e
k.r = j
k.v = j
k.s = c
assert m.p.p.s.p.txt == "a"