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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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