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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
g = C("g")
l = D("l")
e = E("e")
c = F("c")

i.v = l
i.y = g
h.v = c
h.o = c
h.x = i
h.z = l
h.u = l
g.x = c
g.w = l
l.u = e
l.x = e
l.p = i
e.v = l
c.s = l
c.o = i
assert g.x.s.p.y.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: A = None
        self.x: E = None
        self.txt = txt

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

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

i = A("i")
h = B("h")
g = C("g")
l = D("l")
e = E("e")
c = F("c")

i.v = l
i.y = g
h.v = c
h.o = c
h.x = i
h.z = l
h.u = l
g.x = c
g.w = l
l.u = e
l.x = e
l.p = i
e.v = l
c.s = l
c.o = i
assert g.x.s.p.y.w.txt == "l"