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

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

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

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

g = A("g")
a = B("a")
i = C("i")
c = D("c")
n = D("n")
e = D("e")

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

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

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

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

g = A("g")
a = B("a")
i = C("i")
c = D("c")
n = D("n")
e = D("e")

g.v = i
a.r = g
a.u = i
i.r = g
i.o = a
i.s = a
i.u = a
c.w = g
c.p = e
c.o = a
n.w = g
n.p = c
n.o = a
e.w = g
e.p = n
e.o = a
assert c.w.v.o.u.txt == "i"