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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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