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

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

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

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

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

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

a = A("a")
g = B("g")
e = C("e")
b = D("b")
l = E("l")
d = F("d")

a.v = l
g.o = a
g.v = a
g.r = l
g.y = e
e.y = g
e.r = b
b.x = a
b.o = g
l.y = g
l.p = g
d.r = l
d.t = a
assert a.v.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

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

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

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

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

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

a = A("a")
g = B("g")
e = C("e")
b = D("b")
l = E("l")
d = F("d")

a.v = l
g.o = a
g.v = a
g.r = l
g.y = e
e.y = g
e.r = b
b.x = a
b.o = g
l.y = g
l.p = g
d.r = l
d.t = a
assert a.v.y.r.txt == "l"