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

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: E = None
        self.x: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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

l.x = m
l.v = f
k.x = f
n.o = b
n.r = k
a.z = l
a.r = m
a.v = m
a.x = f
m.v = d
m.y = f
m.r = a
m.o = b
f.v = m
f.x = l
b.p = a
e.x = f
d.x = f
assert f.x.v.v.y.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.r: E = None
        self.x: F = None
        self.v: E = None
        self.txt = txt

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

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

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

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

l.x = m
l.v = f
k.x = f
n.o = b
n.r = k
a.z = l
a.r = m
a.v = m
a.x = f
m.v = d
m.y = f
m.r = a
m.o = b
f.v = m
f.x = l
b.p = a
e.x = f
d.x = f
assert f.x.v.v.y.v.r.txt == "a"