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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.p: D = None
        self.v: B = None
        self.z: E = None
        self.txt = txt

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

e.p = l
e.y = l
m.q = a
l.r = i
l.t = h
d.w = e
d.z = l
i.s = f
i.u = e
i.p = l
h.t = l
h.w = m
h.v = m
h.p = d
h.z = i
a.w = e
a.z = l
g.t = l
g.w = m
g.v = m
g.p = a
g.z = i
f.t = l
f.w = m
f.v = m
f.p = a
f.z = i
assert g.v.q.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.y: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.w: B = None
        self.p: D = None
        self.v: B = None
        self.z: E = None
        self.txt = txt

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

e.p = l
e.y = l
m.q = a
l.r = i
l.t = h
d.w = e
d.z = l
i.s = f
i.u = e
i.p = l
h.t = l
h.w = m
h.v = m
h.p = d
h.z = i
a.w = e
a.z = l
g.t = l
g.w = m
g.v = m
g.p = a
g.z = i
f.t = l
f.w = m
f.v = m
f.p = a
f.z = i
assert g.v.q.z.r.txt == "i"