class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.p: F = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: E = None
        self.z: B = None
        self.o: E = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: E = None
        self.z: B = None
        self.o: E = None
        self.r: C = None
        self.txt = txt

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

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

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

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

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