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

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: H = None
        self.o: C = None
        self.u: D = None
        self.p: C = None
        self.x: C = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: B = None
        self.u: E = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: G = None
        self.u: A = None
        self.x: C = None
        self.s: D = None
        self.txt = txt

f = A("f")
k = B("k")
b = C("b")
h = D("h")
m = E("m")
e = F("e")
c = G("c")
a = H("a")

f.z = h
f.x = h
k.r = h
k.x = c
b.p = m
b.v = k
b.z = f
b.q = c
b.x = e
h.o = c
m.p = f
e.s = c
e.y = a
e.o = b
e.p = b
e.x = b
e.u = h
e.r = k
e.z = k
c.t = h
c.p = k
c.u = m
c.r = e
a.w = m
a.o = c
a.u = f
a.x = b
a.s = h
assert e.r.r.o.r.s.p.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.y: H = None
        self.o: C = None
        self.u: D = None
        self.p: C = None
        self.x: C = None
        self.r: B = None
        self.z: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: B = None
        self.u: E = None
        self.r: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.o: G = None
        self.u: A = None
        self.x: C = None
        self.s: D = None
        self.txt = txt

f = A("f")
k = B("k")
b = C("b")
h = D("h")
m = E("m")
e = F("e")
c = G("c")
a = H("a")

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