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

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

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

d = A("d")
h = B("h")
g = C("g")
e = B("e")
j = A("j")
f = C("f")
k = B("k")

d.v = j
d.s = h
d.p = k
h.v = d
h.y = g
h.t = g
g.p = d
g.x = h
g.u = e
e.v = j
e.y = f
e.t = g
j.v = d
j.s = e
j.p = h
f.p = j
f.x = e
f.u = k
k.v = d
k.y = g
k.t = f
assert d.v.v.v.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.s: B = None
        self.p: B = None
        self.txt = txt

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

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

d = A("d")
h = B("h")
g = C("g")
e = B("e")
j = A("j")
f = C("f")
k = B("k")

d.v = j
d.s = h
d.p = k
h.v = d
h.y = g
h.t = g
g.p = d
g.x = h
g.u = e
e.v = j
e.y = f
e.t = g
j.v = d
j.s = e
j.p = h
f.p = j
f.x = e
f.u = k
k.v = d
k.y = g
k.t = f
assert d.v.v.v.v.v.v.txt == "d"