class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: C = None
        self.q: F = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: C = None
        self.q: E = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

k = A("k")
i = B("i")
d = C("d")
n = D("n")
j = E("j")
a = F("a")
c = G("c")

k.r = j
k.p = j
k.u = d
k.q = a
k.y = n
i.o = j
d.z = a
d.r = a
d.y = n
d.s = n
d.o = n
n.w = i
n.q = j
j.x = c
a.s = i
c.o = j
c.q = j
c.v = d
c.t = a
c.p = i
assert n.w.o.x.p.o.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.u: C = None
        self.q: F = None
        self.y: D = None
        self.p: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: C = None
        self.q: E = None
        self.t: F = None
        self.p: B = None
        self.txt = txt

k = A("k")
i = B("i")
d = C("d")
n = D("n")
j = E("j")
a = F("a")
c = G("c")

k.r = j
k.p = j
k.u = d
k.q = a
k.y = n
i.o = j
d.z = a
d.r = a
d.y = n
d.s = n
d.o = n
n.w = i
n.q = j
j.x = c
a.s = i
c.o = j
c.q = j
c.v = d
c.t = a
c.p = i
assert n.w.o.x.p.o.x.v.txt == "d"