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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.p: F = None
        self.q: D = None
        self.r: E = None
        self.w: E = 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.x: G = None
        self.p: F = None
        self.o: B = None
        self.t: B = None
        self.z: G = None
        self.u: B = None
        self.r: G = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: G = None
        self.p: F = None
        self.q: D = None
        self.r: E = None
        self.w: E = 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.x: G = None
        self.p: F = None
        self.o: B = None
        self.t: B = None
        self.z: G = None
        self.u: B = None
        self.r: G = None
        self.txt = txt

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

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

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

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