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

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.y: B = None
        self.t: C = None
        self.txt = txt

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

c = A("c")
g = B("g")
e = C("e")
h = D("h")
a = C("a")
b = B("b")
j = C("j")
i = D("i")

c.v = i
g.w = a
g.t = e
g.p = c
e.x = h
e.v = a
e.t = a
e.y = g
h.u = j
h.p = j
h.y = b
h.t = c
a.x = i
a.v = e
a.t = e
a.y = g
b.w = j
b.t = j
b.p = c
j.x = i
j.v = e
j.y = g
j.t = a
i.u = j
i.p = a
i.y = b
i.t = c
assert b.t.t.y.p.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.v: C = None
        self.y: B = None
        self.t: C = None
        self.txt = txt

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

c = A("c")
g = B("g")
e = C("e")
h = D("h")
a = C("a")
b = B("b")
j = C("j")
i = D("i")

c.v = i
g.w = a
g.t = e
g.p = c
e.x = h
e.v = a
e.t = a
e.y = g
h.u = j
h.p = j
h.y = b
h.t = c
a.x = i
a.v = e
a.t = e
a.y = g
b.w = j
b.t = j
b.p = c
j.x = i
j.v = e
j.y = g
j.t = a
i.u = j
i.p = a
i.y = b
i.t = c
assert b.t.t.y.p.v.u.txt == "j"