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

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.p: B = None
        self.t: B = None
        self.txt = txt

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

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

i.x = c
g.v = k
g.r = i
g.u = h
g.p = c
c.o = g
c.t = g
c.s = a
c.p = h
a.y = c
a.t = c
a.r = k
a.w = h
h.v = k
h.r = i
h.u = g
h.p = c
k.x = c
assert c.p.p.o.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: B = None
        self.s: D = None
        self.p: B = None
        self.t: B = None
        self.txt = txt

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

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

i.x = c
g.v = k
g.r = i
g.u = h
g.p = c
c.o = g
c.t = g
c.s = a
c.p = h
a.y = c
a.t = c
a.r = k
a.w = h
h.v = k
h.r = i
h.u = g
h.p = c
k.x = c
assert c.p.p.o.u.p.s.txt == "a"