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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: E = None
        self.x: B = None
        self.r: E = None
        self.o: E = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: B = None
        self.y: A = None
        self.z: D = None
        self.v: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: A = None
        self.s: E = None
        self.x: B = None
        self.r: E = None
        self.o: E = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: B = None
        self.y: A = None
        self.z: D = None
        self.v: B = None
        self.txt = txt

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

d.p = g
c.x = i
i.t = d
i.s = h
i.r = h
i.o = h
i.y = h
i.x = c
i.w = g
a.o = g
a.y = f
h.s = c
h.z = c
h.w = g
h.o = i
n.u = g
n.y = g
l.u = h
l.p = c
l.v = c
l.y = d
l.z = a
g.o = a
g.y = n
f.u = g
f.y = g
assert c.x.w.o.txt == "a"