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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
a = D("a")
c = B("c")
j = A("j")
e = C("e")
l = D("l")
k = D("k")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

g = A("g")
d = B("d")
f = C("f")
a = D("a")
c = B("c")
j = A("j")
e = C("e")
l = D("l")
k = D("k")

g.s = c
g.p = a
d.v = l
f.s = j
f.x = l
f.u = g
f.y = a
a.s = d
c.v = l
j.s = c
j.p = l
e.s = j
e.u = j
e.x = k
e.y = l
l.s = c
k.s = d
assert k.s.v.s.v.s.v.s.txt == "c"