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

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: B = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
m = C("m")
n = D("n")
g = E("g")
e = F("e")
i = G("i")
l = E("l")
d = E("d")
k = C("k")

j.r = i
f.z = m
f.y = n
m.y = j
m.r = d
n.p = i
n.u = f
g.v = f
g.u = f
e.x = g
e.s = f
i.q = m
i.v = n
l.v = f
l.u = f
d.v = f
d.u = f
k.y = j
k.r = d
assert g.u.z.y.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: B = None
        self.txt = txt

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

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

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

j = A("j")
f = B("f")
m = C("m")
n = D("n")
g = E("g")
e = F("e")
i = G("i")
l = E("l")
d = E("d")
k = C("k")

j.r = i
f.z = m
f.y = n
m.y = j
m.r = d
n.p = i
n.u = f
g.v = f
g.u = f
e.x = g
e.s = f
i.q = m
i.v = n
l.v = f
l.u = f
d.v = f
d.u = f
k.y = j
k.r = d
assert g.u.z.y.r.v.txt == "n"