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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.q: G = None
        self.z: C = None
        self.u: C = None
        self.y: C = None
        self.w: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: B = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.z: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.s: F = None
        self.q: G = None
        self.z: C = None
        self.u: C = None
        self.y: C = None
        self.w: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: B = None
        self.w: D = None
        self.x: D = None
        self.txt = txt

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

k.u = l
k.w = l
i.o = l
i.z = k
f.o = l
f.p = l
f.z = k
c.y = d
l.o = f
l.z = f
l.u = f
l.y = f
l.w = f
l.s = h
l.q = e
h.s = g
e.u = k
e.v = i
e.w = c
e.x = c
g.s = h
d.y = c
assert g.s.s.s.s.s.s.txt == "g"