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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: D = None
        self.t: D = None
        self.r: A = None
        self.z: C = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
a = C("a")
c = D("c")
k = E("k")
g = C("g")

b.q = i
b.t = k
i.w = c
a.v = g
a.z = g
a.u = c
a.t = c
a.r = b
c.y = k
k.o = c
g.v = a
g.z = a
g.u = c
g.t = c
g.r = b
assert i.w.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.t: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.u: D = None
        self.t: D = None
        self.r: A = None
        self.z: C = None
        self.txt = txt

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

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

b = A("b")
i = B("i")
a = C("a")
c = D("c")
k = E("k")
g = C("g")

b.q = i
b.t = k
i.w = c
a.v = g
a.z = g
a.u = c
a.t = c
a.r = b
c.y = k
k.o = c
g.v = a
g.z = a
g.u = c
g.t = c
g.r = b
assert i.w.y.o.txt == "c"