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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: F = None
        self.r: A = None
        self.w: E = None
        self.v: E = None
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: G = None
        self.q: G = None
        self.s: D = None
        self.p: G = None
        self.x: D = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
i = C("i")
n = D("n")
e = E("e")
f = F("f")
l = G("l")

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: F = None
        self.r: A = None
        self.w: E = None
        self.v: E = None
        self.q: E = None
        self.p: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.y: G = None
        self.q: G = None
        self.s: D = None
        self.p: G = None
        self.x: D = None
        self.txt = txt

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

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

h = A("h")
a = B("a")
i = C("i")
n = D("n")
e = E("e")
f = F("f")
l = G("l")

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