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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: G = None
        self.p: C = None
        self.v: F = None
        self.w: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.v: F = None
        self.p: F = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: G = None
        self.p: C = None
        self.v: F = None
        self.w: C = None
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.v: F = None
        self.p: F = None
        self.txt = txt

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

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

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

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

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