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

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: A = None
        self.p: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.o: D = None
        self.s: A = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

m = A("m")
j = B("j")
k = C("k")
c = D("c")
n = E("n")
a = F("a")
b = G("b")
h = C("h")

m.r = a
m.w = j
m.t = b
j.s = a
j.t = k
j.u = k
k.t = h
c.s = m
c.r = m
c.p = a
n.o = b
n.v = a
n.q = a
n.p = a
n.x = k
a.r = j
a.x = j
a.p = j
a.o = c
a.z = c
a.s = m
b.z = n
h.t = k
assert c.p.z.r.r.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.w: B = None
        self.t: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: A = None
        self.r: A = None
        self.p: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.o: D = None
        self.s: A = None
        self.p: B = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

m = A("m")
j = B("j")
k = C("k")
c = D("c")
n = E("n")
a = F("a")
b = G("b")
h = C("h")

m.r = a
m.w = j
m.t = b
j.s = a
j.t = k
j.u = k
k.t = h
c.s = m
c.r = m
c.p = a
n.o = b
n.v = a
n.q = a
n.p = a
n.x = k
a.r = j
a.x = j
a.p = j
a.o = c
a.z = c
a.s = m
b.z = n
h.t = k
assert c.p.z.r.r.s.r.txt == "a"