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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: D = None
        self.txt = txt

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

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

i = A("i")
g = B("g")
j = C("j")
c = D("c")
d = E("d")
e = F("e")
h = G("h")
m = C("m")
a = B("a")

i.z = e
i.s = g
i.r = c
i.p = d
i.o = d
g.p = a
j.w = a
c.p = a
c.s = e
d.q = e
d.r = c
e.z = i
e.v = a
e.r = g
e.w = h
h.p = m
h.r = e
m.w = g
a.p = g
assert i.s.p.p.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: B = None
        self.r: D = None
        self.p: E = None
        self.o: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: F = None
        self.r: D = None
        self.txt = txt

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

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

i = A("i")
g = B("g")
j = C("j")
c = D("c")
d = E("d")
e = F("e")
h = G("h")
m = C("m")
a = B("a")

i.z = e
i.s = g
i.r = c
i.p = d
i.o = d
g.p = a
j.w = a
c.p = a
c.s = e
d.q = e
d.r = c
e.z = i
e.v = a
e.r = g
e.w = h
h.p = m
h.r = e
m.w = g
a.p = g
assert i.s.p.p.p.p.p.txt == "a"