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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: F = None
        self.w: C = None
        self.x: A = None
        self.y: D = None
        self.s: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.q: F = None
        self.w: C = None
        self.x: A = None
        self.y: D = None
        self.s: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.o: C = None
        self.txt = txt

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

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

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