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

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

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

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

e = A("e")
g = B("g")
m = C("m")
l = D("l")
n = C("n")
b = D("b")
f = A("f")
i = B("i")

e.r = f
e.x = b
e.v = i
g.x = e
m.v = e
l.y = b
n.v = f
b.y = l
f.r = e
f.x = l
f.v = i
i.x = e
assert f.x.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.x: D = None
        self.v: B = None
        self.txt = txt

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

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

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

e = A("e")
g = B("g")
m = C("m")
l = D("l")
n = C("n")
b = D("b")
f = A("f")
i = B("i")

e.r = f
e.x = b
e.v = i
g.x = e
m.v = e
l.y = b
n.v = f
b.y = l
f.r = e
f.x = l
f.v = i
i.x = e
assert f.x.y.y.txt == "l"