class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: B = None
        self.r: D = None
        self.y: C = None
        self.z: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

f = A("f")
e = B("e")
g = C("g")
d = D("d")
h = E("h")
n = F("n")
l = G("l")
b = G("b")

f.p = n
f.z = n
f.w = e
f.r = d
f.y = g
e.p = h
e.z = h
e.u = g
g.z = b
g.u = n
g.p = h
d.r = h
d.x = b
d.q = e
h.y = g
h.x = d
n.s = d
l.p = b
l.r = g
l.q = f
l.v = e
l.y = n
b.p = l
b.r = g
b.q = f
b.v = e
b.y = n
assert h.y.z.p.v.u.z.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.w: B = None
        self.r: D = None
        self.y: C = None
        self.z: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

f = A("f")
e = B("e")
g = C("g")
d = D("d")
h = E("h")
n = F("n")
l = G("l")
b = G("b")

f.p = n
f.z = n
f.w = e
f.r = d
f.y = g
e.p = h
e.z = h
e.u = g
g.z = b
g.u = n
g.p = h
d.r = h
d.x = b
d.q = e
h.y = g
h.x = d
n.s = d
l.p = b
l.r = g
l.q = f
l.v = e
l.y = n
b.p = l
b.r = g
b.q = f
b.v = e
b.y = n
assert h.y.z.p.v.u.z.q.y.txt == "g"