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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: G = None
        self.z: B = None
        self.p: A = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: B = None
        self.txt = txt

i = A("i")
c = B("c")
h = C("h")
l = D("l")
b = E("b")
f = F("f")
g = G("g")

i.t = b
i.r = b
i.q = f
i.p = h
c.p = l
c.w = b
h.x = i
h.p = i
h.v = g
h.z = c
h.q = l
l.p = g
b.v = l
b.z = h
b.s = c
f.t = h
g.y = f
g.v = c
assert l.p.v.w.s.w.z.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.q: F = None
        self.r: E = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.v: G = None
        self.z: B = None
        self.p: A = None
        self.q: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: C = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.v: B = None
        self.txt = txt

i = A("i")
c = B("c")
h = C("h")
l = D("l")
b = E("b")
f = F("f")
g = G("g")

i.t = b
i.r = b
i.q = f
i.p = h
c.p = l
c.w = b
h.x = i
h.p = i
h.v = g
h.z = c
h.q = l
l.p = g
b.v = l
b.z = h
b.s = c
f.t = h
g.y = f
g.v = c
assert l.p.v.w.s.w.z.txt == "h"