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

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

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

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

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

g.v = c
a.w = h
d.u = g
d.s = g
d.v = k
d.t = a
k.o = h
k.w = g
n.u = h
n.s = h
n.v = k
n.t = a
h.v = c
c.w = h
assert c.w.v.w.v.w.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

g.v = c
a.w = h
d.u = g
d.s = g
d.v = k
d.t = a
k.o = h
k.w = g
n.u = h
n.s = h
n.v = k
n.t = a
h.v = c
c.w = h
assert c.w.v.w.v.w.v.w.txt == "h"