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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: A = None
        self.o: F = None
        self.s: C = None
        self.t: D = None
        self.z: C = None
        self.txt = txt

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

c.s = k
c.w = k
c.x = g
d.y = c
i.s = j
i.q = m
m.t = i
m.v = k
m.o = c
j.v = k
j.q = k
j.t = c
j.w = c
j.y = g
j.p = i
j.r = d
g.p = d
k.w = m
k.t = m
k.p = c
k.o = g
k.s = i
k.z = i
assert g.p.y.x.p.y.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: F = None
        self.w: G = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: A = None
        self.o: F = None
        self.s: C = None
        self.t: D = None
        self.z: C = None
        self.txt = txt

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

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