class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: F = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

e.y = n
e.o = l
e.s = a
j.x = f
j.o = a
j.v = n
f.x = l
f.w = l
f.v = d
a.y = e
a.v = n
a.w = j
a.r = f
n.r = l
l.o = e
l.v = f
l.p = j
d.o = j
assert d.o.o.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: F = None
        self.s: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

e.y = n
e.o = l
e.s = a
j.x = f
j.o = a
j.v = n
f.x = l
f.w = l
f.v = d
a.y = e
a.v = n
a.w = j
a.r = f
n.r = l
l.o = e
l.v = f
l.p = j
d.o = j
assert d.o.o.r.v.txt == "d"