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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: A = None
        self.txt = txt

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

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

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

g.v = k
g.y = l
g.x = c
g.o = i
l.o = k
l.q = i
l.w = c
i.q = c
i.s = g
k.w = h
c.s = l
c.r = l
h.w = k
assert i.s.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.y: B = None
        self.x: E = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: A = None
        self.txt = txt

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

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

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

g.v = k
g.y = l
g.x = c
g.o = i
l.o = k
l.q = i
l.w = c
i.q = c
i.s = g
k.w = h
c.s = l
c.r = l
h.w = k
assert i.s.o.q.txt == "c"