class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: G = None
        self.w: F = None
        self.x: G = None
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: F = 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.r: A = None
        self.p: E = None
        self.txt = txt

c = A("c")
k = B("k")
m = C("m")
a = D("a")
f = E("f")
l = F("l")
b = G("b")
h = E("h")
e = E("e")
d = F("d")

c.o = b
c.z = b
c.x = b
c.w = d
c.r = l
k.z = l
k.o = a
m.z = h
m.p = a
a.u = k
a.x = m
a.w = b
a.s = b
f.w = h
f.y = d
l.s = d
b.r = c
b.p = h
h.w = e
h.y = d
e.w = h
e.y = l
d.s = l
assert a.x.z.w.w.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: G = None
        self.z: G = None
        self.w: F = None
        self.x: G = None
        self.r: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: E = None
        self.y: F = 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.r: A = None
        self.p: E = None
        self.txt = txt

c = A("c")
k = B("k")
m = C("m")
a = D("a")
f = E("f")
l = F("l")
b = G("b")
h = E("h")
e = E("e")
d = F("d")

c.o = b
c.z = b
c.x = b
c.w = d
c.r = l
k.z = l
k.o = a
m.z = h
m.p = a
a.u = k
a.x = m
a.w = b
a.s = b
f.w = h
f.y = d
l.s = d
b.r = c
b.p = h
h.w = e
h.y = d
e.w = h
e.y = l
d.s = l
assert a.x.z.w.w.y.txt == "d"