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

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

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

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

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

g.v = k
g.w = j
g.t = j
h.q = c
h.w = j
h.y = d
h.v = k
a.u = k
a.w = k
a.q = g
a.x = g
k.p = d
k.z = c
k.x = a
c.v = k
c.w = h
c.t = h
d.u = k
d.w = k
d.q = c
d.x = g
j.q = g
j.w = h
j.y = a
j.v = k
assert h.y.x.w.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

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

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

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

g.v = k
g.w = j
g.t = j
h.q = c
h.w = j
h.y = d
h.v = k
a.u = k
a.w = k
a.q = g
a.x = g
k.p = d
k.z = c
k.x = a
c.v = k
c.w = h
c.t = h
d.u = k
d.w = k
d.q = c
d.x = g
j.q = g
j.w = h
j.y = a
j.v = k
assert h.y.x.w.y.x.txt == "g"