class A:
    def __init__(self, txt: str):
        self.q: G = None
        self.x: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.t: G = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.t: G = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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