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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: A = None
        self.txt = txt

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

h = A("h")
i = B("i")
k = C("k")
j = D("j")
f = E("f")
a = F("a")
e = E("e")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: A = None
        self.txt = txt

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

h = A("h")
i = B("i")
k = C("k")
j = D("j")
f = E("f")
a = F("a")
e = E("e")

h.w = a
h.u = j
i.v = f
i.q = h
i.t = h
i.z = h
i.s = j
i.r = a
k.z = a
k.r = a
j.x = h
j.s = k
f.v = a
f.z = h
a.z = e
a.r = e
a.p = k
e.v = a
e.z = h
assert i.r.p.z.p.r.p.r.txt == "a"